In a karaoke system, the most fundamental technique involves audio-mixing algorithms, which are however the most difficult matters. At present, there normally exist the following audio-mixing algorithms in the Internet and open source codes.
One audio-mixing algorithm is adding and averaging, which has a disadvantage of low volume but has an advantage of no overflow. However, overflow will occur in a case that a signal is directly multiplied by a factor for amplification.
Another audio-mixing algorithm is directly adding, which can well preserve volume, but has a disadvantage that a break is generated in a case of overflow, resulting in frequency distortion and loss of sound quality.
In yet another audio-mixing algorithm, a formula Y=A+B−(A*B/(−(2pow(n−1)−1))) is used, where A and B are signals of two channels to be mixed, n is the number of sample points, and pow represents an exponentiation operation. The algorithm does not lead to overflow, but leads to weakened middle pitch. Additionally, the algorithm is not suitable for a situation where it is required to multiply A and B by an amplification factor, because the algorithm may lead to an overflow if A and B are multiplied by the amplification factor.
The above algorithms all have their disadvantages, and none of them can support the application of mixing signals of multiple channels in proportion.